home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / frame.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-21  |  6.2 KB  |  207 lines

  1. /* Definitions for dealing with stack frames, for GDB, the GNU debugger.
  2.    Copyright 1986, 1989, 1991, 1992 Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #if !defined (FRAME_H)
  21. #define FRAME_H 1
  22.  
  23. /* FRAME is the type of the identifier of a specific stack frame.  It
  24.    is a pointer to the frame cache item corresponding to this frame.
  25.    Please note that frame id's are *not* constant over calls to the
  26.    inferior.  Use frame addresses, which are.
  27.   
  28.    FRAME_ADDR is the type of the address of a specific frame.  I
  29.    cannot imagine a case in which this would not be CORE_ADDR, so
  30.    maybe it's silly to give it it's own type.  Life's rough.
  31.   
  32.    FRAME_FP is a macro which converts from a frame identifier into a
  33.    frame_address.
  34.   
  35.    FRAME_INFO_ID is a macro which "converts" from a frame info pointer
  36.    to a frame id.  This is here in case I or someone else decides to
  37.    change the FRAME type again.
  38.   
  39.    This file and blockframe.c are the only places which are allowed to
  40.    use the equivalence between FRAME and struct frame_info *.  EXCEPTION:
  41.    value.h uses CORE_ADDR instead of FRAME_ADDR because the compiler
  42.    will accept that in the absence of this file.
  43.    FIXME:  Prototypes in other files make use of the equivalence between
  44.            "FRAME" and "struct frame_info *" and the equivalence between
  45.        CORE_ADDR and FRAME_ADDR.  */
  46.  
  47. typedef struct frame_info *FRAME;
  48. typedef CORE_ADDR    FRAME_ADDR;
  49. #define FRAME_FP(fr)    ((fr)->frame)
  50. #define FRAME_INFO_ID(f)    (f)
  51.  
  52. /* Caching structure for stack frames.  This is also the structure
  53.    used for extended info about stack frames.  May add more to this
  54.    structure as it becomes necessary.
  55.   
  56.    Note that the first entry in the cache will always refer to the
  57.    innermost executing frame.  This value is set in wait_for_inferior.  */
  58.  
  59. struct frame_info
  60.   {
  61.     /* Nominal address of the frame described.  */
  62.     FRAME_ADDR frame;
  63.     /* Address at which execution is occurring in this frame.
  64.        For the innermost frame, it's the current pc.
  65.        For other frames, it is a pc saved in the next frame.  */
  66.     CORE_ADDR pc;
  67.     /* The frame called by the frame we are describing, or 0.
  68.        This may be set even if there isn't a frame called by the one
  69.        we are describing (.->next == 0); in that case it is simply the
  70.        bottom of this frame */
  71.     FRAME_ADDR next_frame;
  72.     /* Anything extra for this structure that may have been defined
  73.        in the machine depedent files. */
  74. #ifdef EXTRA_FRAME_INFO
  75.     EXTRA_FRAME_INFO
  76. #endif
  77.     /* Pointers to the next and previous frame_info's in this stack.  */
  78.     FRAME next, prev;
  79.   };
  80.  
  81. /* Describe the saved registers of a frame.  */
  82.  
  83. struct frame_saved_regs
  84.   {
  85.     /* For each register, address of where it was saved on entry to the frame,
  86.        or zero if it was not saved on entry to this frame.  */
  87.     CORE_ADDR regs[NUM_REGS];
  88.   };
  89.  
  90. /* Define a default FRAME_CHAIN_VALID, in the form that is suitable for most
  91.    targets.  If FRAME_CHAIN_VALID returns zero it means that the given frame
  92.    is the outermost one and has no caller.
  93.  
  94.    If a particular target needs a different definition, then it can override
  95.    the definition here by providing one in the tm file. */
  96.  
  97. #if !defined (FRAME_CHAIN_VALID)
  98.  
  99. #if defined (FRAME_CHAIN_VALID_ALTERNATE)
  100.  
  101. /* Use the alternate method of avoiding running up off the end of the frame
  102.    chain or following frames back into the startup code.  See the comments
  103.    in objfiles.h. */
  104.    
  105. #define FRAME_CHAIN_VALID(chain, thisframe)    \
  106.   ((chain) != 0                    \
  107.    && !inside_main_func ((thisframe) -> pc)    \
  108.    && !inside_entry_func ((thisframe) -> pc))
  109.  
  110. #else
  111.  
  112. #define FRAME_CHAIN_VALID(chain, thisframe)    \
  113.   ((chain) != 0                    \
  114.    && !inside_entry_file (FRAME_SAVED_PC (thisframe)))
  115.  
  116. #endif    /* FRAME_CHAIN_VALID_ALTERNATE */
  117.  
  118. #endif    /* FRAME_CHAIN_VALID */
  119.  
  120. /* The stack frame that the user has specified for commands to act on.
  121.    Note that one cannot assume this is the address of valid data.  */
  122.  
  123. extern FRAME selected_frame;
  124.  
  125. /* Level of the selected frame:
  126.    0 for innermost, 1 for its caller, ...
  127.    or -1 for frame specified by address with no defined level.  */
  128.  
  129. extern int selected_frame_level;
  130.  
  131. extern struct frame_info *
  132. get_frame_info PARAMS ((FRAME));
  133.  
  134. extern struct frame_info *
  135. get_prev_frame_info PARAMS ((FRAME));
  136.  
  137. extern FRAME
  138. create_new_frame PARAMS ((FRAME_ADDR, CORE_ADDR));
  139.  
  140. extern void
  141. flush_cached_frames PARAMS ((void));
  142.  
  143. extern void
  144. reinit_frame_cache PARAMS ((void));
  145.  
  146. extern void
  147. get_frame_saved_regs PARAMS ((struct frame_info *, struct frame_saved_regs *));
  148.  
  149. extern void
  150. set_current_frame PARAMS ((FRAME));
  151.  
  152. extern FRAME
  153. get_prev_frame PARAMS ((FRAME));
  154.  
  155. extern FRAME
  156. get_current_frame PARAMS ((void));
  157.  
  158. extern FRAME
  159. get_next_frame PARAMS ((FRAME));
  160.  
  161. extern struct block *
  162. get_frame_block PARAMS ((FRAME));
  163.  
  164. extern struct block *
  165. get_current_block PARAMS ((void));
  166.  
  167. extern struct block *
  168. get_selected_block PARAMS ((void));
  169.  
  170. extern struct symbol *
  171. get_frame_function PARAMS ((FRAME));
  172.  
  173. extern CORE_ADDR
  174. get_frame_pc PARAMS ((FRAME));
  175.  
  176. extern CORE_ADDR
  177. get_pc_function_start PARAMS ((CORE_ADDR));
  178.  
  179. extern struct block *
  180. block_for_pc PARAMS ((CORE_ADDR));
  181.  
  182. extern int
  183. frameless_look_for_prologue PARAMS ((FRAME));
  184.  
  185. extern void
  186. print_frame_args PARAMS ((struct symbol *, struct frame_info *, int, FILE *));
  187.  
  188. extern FRAME
  189. find_relative_frame PARAMS ((FRAME, int*));
  190.  
  191. extern void
  192. print_stack_frame PARAMS ((FRAME, int, int));
  193.  
  194. extern void
  195. select_frame PARAMS ((FRAME, int));
  196.  
  197. extern void
  198. record_selected_frame PARAMS ((FRAME_ADDR *, int *));
  199.  
  200. extern void
  201. print_frame_info PARAMS ((struct frame_info *, int, int, int));
  202.  
  203. extern CORE_ADDR
  204. find_saved_register PARAMS ((FRAME, int));
  205.  
  206. #endif /* !defined (FRAME_H)  */
  207.